package br.fot.granola.oboe.graphics;

import java.util.HashSet;

import br.fot.granola.oboe.core.Oboe;
import br.fot.granola.oboe.core.Slot;
import br.fot.granola.oboe.graphics.camera.Camera;

public class Scene 
{
	public final HashSet<Node> children = new HashSet<Node>();
	
	@Slot public void onUpdate()
	{
		Oboe.signalDown( this, "onUpdate" );
	}
	
	@Slot public void onAddChild( Object o )
	{
		if( o instanceof Node )
		{
			((Node) o).parentScene = this;
			if( !(o instanceof Camera) )
			{
				this.children.add( (Node) o );
			}
		}
	}
	
	@Slot public void onRemoveChild( Object o )
	{
		if( o instanceof Node )
		{
			this.children.remove( (Node) o );
			((Node) o).parentScene = null;
		}
	}
}
